//
//  ConversationModel.m
//  MiniWeChat
//
//  Created by ByteDance on 2025/6/25.
//

#import "ConversationModel.h"

@implementation ConversationModel

- (void)encodeWithCoder:(NSCoder *)coder {
    [coder encodeObject:self.id forKey:@"id"];
    [coder encodeInteger:self.type forKey:@"type"];
    [coder encodeObject:self.nickname forKey:@"nickname"];
    [coder encodeObject:self.avatar forKey:@"avatar"];
    [coder encodeObject:self.last_msg_id forKey:@"last_msg_id"];
    [coder encodeObject:self.last_msg_content forKey:@"last_msg_content"];
    [coder encodeInteger:self.last_msg_time forKey:@"last_msg_time"];
    [coder encodeInteger:self.unread_count forKey:@"unread_count"];
    [coder encodeInteger:self.is_top forKey:@"is_top"];
    [coder encodeInteger:self.is_muted forKey:@"is_muted"];
}

- (instancetype)initWithCoder:(NSCoder *)coder {
    self = [super init];
    if (self) {
        self.id = [coder decodeObjectForKey:@"id"];
        self.type = [coder decodeIntegerForKey:@"type"];
        self.nickname = [coder decodeObjectForKey:@"nickname"];
        self.avatar = [coder decodeObjectForKey:@"avatar"];
        self.last_msg_id = [coder decodeObjectForKey:@"last_msg_id"];
        self.last_msg_content = [coder decodeObjectForKey:@"last_msg_content"];
        self.last_msg_time = [coder decodeIntegerForKey:@"last_msg_time"];
        self.unread_count = [coder decodeIntegerForKey:@"unread_count"];
        self.is_top = [coder decodeIntegerForKey:@"is_top"];
        self.is_muted = [coder decodeIntegerForKey:@"is_muted"];
    }
    return self;
}

@end
